package personal.service.accounting;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import personal.dao.accounting.WeeklyBalanceDAO;
import personal.domain.accounting.WeeklyBalance;


@Service
public class WeeklyBalanceServiceImpl implements WeeklyBalanceService {
	
	private WeeklyBalanceDAO weeklyBalanceDAO;

	public WeeklyBalanceDAO getWeeklyBalanceDAO() {
		return weeklyBalanceDAO;
	}

	@Autowired(required=false)
	public void setWeeklyBalanceDAO(WeeklyBalanceDAO weeklyBalanceDAO) {
		this.weeklyBalanceDAO = weeklyBalanceDAO;
	}

	@Override
	@Transactional(readOnly=true)
	public List<WeeklyBalance> getAllWeeklyBalances() {
		return weeklyBalanceDAO.getAllWeeklyBalances();
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void saveWeeklyBalances(List<WeeklyBalance> wBalances) {
		weeklyBalanceDAO.saveWeeklyBalances(wBalances);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void deleteWeeklyBalances(List<String> descriptions) {
		weeklyBalanceDAO.deleteWeeklyBalances(descriptions);
	}

}
